package edu.sctu.xialei.May.day20150526one;


import java.util.HashMap;
import java.util.Scanner;

/**
 * Created by Administrator on 5/26/2015.
 */
public class HashMapData {

    private HashMap<Integer,Dog> creatMap(int size){

        HashMap<Integer,Dog> map = new HashMap<Integer,Dog>();

        for (int i = 0; i < size; i++) {
            map.put(i,new Dog());
        }
        return map;
    }

    public HashMap<Integer,Dog> setHashMapValue(int size){

        Scanner input = new Scanner(System.in);

        HashMap<Integer,Dog> map = this.creatMap(size);

        for (int i = 0; i < map.size(); i++) {
            System.out.println("\n***请输入第 " + (i+1) + " 个狗狗信息***");

            System.out.println("输入狗狗姓名：");
            map.get(i).dogName = input.next();

            System.out.println("输入狗狗年龄：");
            map.get(i).dogAge = input.nextInt();

            System.out.println("输入狗狗毛色：");
            map.get(i).dogColor = input.next();
        }

        return map;
    }
}
